﻿@model FO.Models.BlogNewsInsert
@{
    ViewBag.Title = "Thêm - Tin tức";
    Layout = "~/Views/Shared/_CpanelLayout.cshtml";
}
<script type="text/javascript" src="@Url.Content("~/ckeditor/ckeditor.js")"></script>
<script type="text/javascript" src="@Url.Content("~/ckeditor/config.js")"></script>
<script type="text/javascript" src="@Url.Content("~/ckfinder/ckfinder.js")"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(".active").removeClass("active");
        $("li[rel=rel-article]").parent().parent().css("display", "block");
        $("li[rel=rel-article]").parent().parent().prev().addClass("active");
        $("li[rel=rel-article]").addClass("active");
        $("li[rel=rel-article-all]").addClass("active");
        $("#browers-img").click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $('#BlogNewsImg').val(fileUrl);
                $('#img-news').attr("src", fileUrl)
            };
            finder.popup();
        });
    });
</script>

<div class="cbread_crumb">
    <ul class="breadcrumb">
        <li><a class="glyphicons home" href="/Cpanel"><i></i>Control panel</a></li>
        <li class="divider"></li>
        <li><a href="@Url.Action("ManagerBlogNews")">Tin tức</a></li>
        <li class="divider"></li>
        <li class="lastli">Thêm</li>
    </ul>
</div>
<div class="content-module-heading cf">
    <div class="separator"></div>
    <div class="heading-buttons">
        <h3 class="glyphicons notes"><i></i>Thêm - Tin tức</h3>
        <div class="clearfix"></div>
    </div>
    <div class="separator"></div>

</div>
<div class="innerLR">

    @using (Html.BeginForm())
    {

        <div class="well" style="padding-bottom: 20px; margin: 0;">
            <p style="float: left;" class="span55">
                <label class="label-text">Tiêu đề - Tiếng Việt</label>
                @Html.TextBoxFor(m => m.BlogNewsTitle, new { @class = "span5" })
                @Html.ValidationMessageFor(m => m.BlogNewsTitle, "", new { @class = "label label-important", @style = "float:left; margin-right:38px;" })
            </p>
            <p style="float: left;" class="span55">
                <label class="label-text">Tiêu đề - Tiếng Anh</label>
                @Html.TextBoxFor(m => m.BlogNewsTitleLang, new { @class = "span5" })
                @Html.ValidationMessageFor(m => m.BlogNewsTitleLang, "", new { @class = "label label-important", @style = "float:left; margin-right:38px;" })
            </p>

            <div class="clr"></div>
            <p style="float: left; width: 30%; margin-right: 10px;">
                <label class="label-text">Loại tin tức</label>
                @Html.DropDownListFor(m => m.BlogNewsCategoryID, (IEnumerable<SelectListItem>)ViewBag.BlogNewsCategoryList)
            </p>
            <div class="clr"></div>
            <p style="float: left;" class="span55">
                <label class="label-text">Tóm tắt - Tiếng Việt</label>
                @Html.TextAreaFor(m => m.BlogNewsSumary, new { @class = "span5", style = "height:100px;" })
                @Html.ValidationMessageFor(m => m.BlogNewsSumary, "", new { @class = "label label-important", @style = "float:left; margin-right:38px;" })
            </p>
            <p style="float: left;" class="span55">
                <label class="label-text">Tóm tắt - Tiếng Anh</label>
                @Html.TextAreaFor(m => m.BlogNewsSumaryLang, new { @class = "span5", style = "height:100px;" })
                @Html.ValidationMessageFor(m => m.BlogNewsSumaryLang, "", new { @class = "label label-important", @style = "float:left; margin-right:38px;" })
            </p>
            <div class="clr"></div>
            <p style="float: left; width: 50%;">
                <label class="label-text">Hình ảnh</label>
                @Html.TextBoxFor(m => m.BlogNewsImg, new { @class = "round default-width-input", @readonly = "readonly" })
                <a id="browers-img" class="btn btn-primary" title="Chọn ảnh" href="#">Chọn ảnh</a>
            </p>

            <div class="clr"></div>
            <p>@Html.ValidationMessageFor(m => m.BlogNewsImg, "", new { @style = "color:red;" }) </p>


            <div class="clr"></div>
            <div id="file-uploader">
                <noscript>
                    <p>Please enable JavaScript to use file uploader.</p>
                    <!-- or put a simple form for upload here -->
                </noscript>
            </div>
            <img id="img-news" style="margin-top:10px;" width="220" height="130" src="@Url.Content("~/Content/Upload/Images/no-image-news.gif")" />
            <p style="width: 100%; float: left; margin-top: 30px;">
                <label class="label-text">Nội dung Tiếng Việt</label>
                @Html.TextAreaFor(m => m.BlogNewsContent, new { id = "description" })
            </p>
            <p style="width: 100%; float: left; margin-top: 30px;">
                <label class="label-text">Nội dung - Tiếng Anh</label>
                @Html.TextAreaFor(m => m.BlogNewsContentLang, new { id = "descriptionLang" })
            </p>
            <p style="width: 100%; float: left;">
                <label class="label-text">Tin nổi bật</label>
                @Html.CheckBoxFor(m => m.BlogNewsHot)
            </p>
            <div class="clr"></div>
            <div class="form-actions">
                <button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Lưu</button>
            </div>
        </div>                    
    }
</div>
<script type="text/javascript">
    var ck = CKEDITOR.instances['BlogNewsContent', ''];
    if (ck)//check if instance exist
    {
        CKEDITOR.remove(ck);
    }

    CKEDITOR.replace('BlogNewsContent', {
        height: '310px',
        enterMode: CKEDITOR.ENTER_BR,
        filebrowserBrowseUrl: '@Url.Content("~/ckfinder/ckfinder.html")',
        filebrowserImageBrowseUrl: '@Url.Content("~/ckfinder/ckfinder.html?type=Images")',
        filebrowserUploadUrl: '@Url.Content("~/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files")',
        filebrowserImageUploadUrl: '@Url.Content("~/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images")',
        filebrowserWindowWidth: 800,
        filebrowserWindowHeight: 500,
        toolbar:
		   [
	{ name: 'document', groups: ['mode', 'document', 'doctools'], items: ['Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates'] },
	{ name: 'clipboard', groups: ['clipboard', 'undo'], items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
	{ name: 'editing', groups: ['find', 'selection', 'spellchecker'], items: ['Find', 'Replace', '-', 'SelectAll', '-', 'Scayt'] },
	{ name: 'forms', items: ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'] },
	'/',
	{ name: 'basicstyles', groups: ['basicstyles', 'cleanup'], items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
	{ name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'], items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language'] },
	{ name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
	{ name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe'] },
	'/',
	{ name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
	{ name: 'colors', items: ['TextColor', 'BGColor'] },
	{ name: 'tools', items: ['Maximize', 'ShowBlocks'] },
	{ name: 'others', items: ['-'] },
	{ name: 'about', items: ['About'] }
		   ],

        // Toolbar groups configuration.
        toolbarGroups: [
            { name: 'document', groups: ['mode', 'document', 'doctools'] },
            { name: 'clipboard', groups: ['clipboard', 'undo'] },
            { name: 'editing', groups: ['find', 'selection', 'spellchecker'] },
            { name: 'forms' },
            '/',
            { name: 'basicstyles', groups: ['basicstyles', 'cleanup'] },
            { name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'] },
            { name: 'links' },
            { name: 'insert' },
            '/',
            { name: 'styles' },
            { name: 'colors' },
            { name: 'tools' },
            { name: 'others' },
            { name: 'about' }
        ]
    });
</script>

<script type="text/javascript">
    var ck = CKEDITOR.instances['BlogNewsContentLang'];
    if (ck)//check if instance exist
    {
        CKEDITOR.remove(ck);
    }

    CKEDITOR.replace('BlogNewsContentLang', {
        height: '310px',
        enterMode: CKEDITOR.ENTER_BR,
        filebrowserBrowseUrl: '@Url.Content("~/ckfinder/ckfinder.html")',
        filebrowserImageBrowseUrl: '@Url.Content("~/ckfinder/ckfinder.html?type=Images")',
        filebrowserUploadUrl: '@Url.Content("~/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files")',
        filebrowserImageUploadUrl: '@Url.Content("~/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images")',
        filebrowserWindowWidth: 800,
        filebrowserWindowHeight: 500,
        toolbar:
		   [
	{ name: 'document', groups: ['mode', 'document', 'doctools'], items: ['Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates'] },
	{ name: 'clipboard', groups: ['clipboard', 'undo'], items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
	{ name: 'editing', groups: ['find', 'selection', 'spellchecker'], items: ['Find', 'Replace', '-', 'SelectAll', '-', 'Scayt'] },
	{ name: 'forms', items: ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'] },
	'/',
	{ name: 'basicstyles', groups: ['basicstyles', 'cleanup'], items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
	{ name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'], items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language'] },
	{ name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
	{ name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe'] },
	'/',
	{ name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
	{ name: 'colors', items: ['TextColor', 'BGColor'] },
	{ name: 'tools', items: ['Maximize', 'ShowBlocks'] },
	{ name: 'others', items: ['-'] },
	{ name: 'about', items: ['About'] }
		   ],

        // Toolbar groups configuration.
        toolbarGroups: [
            { name: 'document', groups: ['mode', 'document', 'doctools'] },
            { name: 'clipboard', groups: ['clipboard', 'undo'] },
            { name: 'editing', groups: ['find', 'selection', 'spellchecker'] },
            { name: 'forms' },
            '/',
            { name: 'basicstyles', groups: ['basicstyles', 'cleanup'] },
            { name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'] },
            { name: 'links' },
            { name: 'insert' },
            '/',
            { name: 'styles' },
            { name: 'colors' },
            { name: 'tools' },
            { name: 'others' },
            { name: 'about' }
        ]
    });
</script>


